uniform extern texture gTex;
float3 LuminanceConv = { 0.2125f, 0.7154f, 0.0721f };

sampler TexS = sampler_state {
	Texture = <gTex>;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;
	//AddressU  = WRAP;
    //AddressV  = WRAP;
};

struct OutputVS {
    float4 posH   : POSITION0;
	float2 tex0   : TEXCOORD0;
};


OutputVS MonochromeVS(float4 posL : POSITION0,float2 tex0: TEXCOORD0) {
    // Zero out our output.
	OutputVS outVS = (OutputVS)0;	
	// Transform to homogeneous clip space.
	// already transformed
	outVS.posH = posL;//mul(float4(posL, 1.0f), gWVP);		
	outVS.tex0 = tex0; 
    return outVS;
}

float4 MonochromePS(float2 tex0 : TEXCOORD0) : COLOR {    
	return dot( (float3)tex2D( TexS, tex0 ), LuminanceConv );
	//return  tex2D(TexS, tex0) * 0.2;
}

technique MonochromeTech {

    pass P0 {
        vertexShader = compile vs_2_0 MonochromeVS();
        pixelShader  = compile ps_2_0 MonochromePS();
    }
}
